#!/usr/bin/python

lists = {
    'blocklist': 'source_data/disposable_email_blocklist.conf',
    'allowlist': 'source_data/allowlist.conf',
}


def parse_list(listname, filename):
    return "{} = {{\n{}}}".format(
        listname,
        "".join([
            "    '{}',\n".format(line.rstrip())
            for line in open(filename).readlines()
        ])
    )


print("\n\n".join([parse_list(*args) for args in sorted(lists.items())]))

print("""
# For backwards compatibility
locals()['tsilkcalb'[::-1]] = blocklist
locals()['tsiletihw'[::-1]] = allowlist""")
